ass Solution {
public:
    int balancedStringSplit(string s) {
        int R_count=0;
        int L_count=0;
        int ret=0;
        for(int i=0;i<s.size();i++)
        {
            if(s[i]=='R')
            {
                R_count++;
            }
            else
            {
                L_count++;
            }
            if(R_count==L_count)
            {
                ret++;
                R_count=0;
                L_count=0;
            }
        }
        return ret;
    }
};



class Solution {
public:
    vector<string> commonChars(vector<string>& words) {
        //遍历 拿最小值 更新数组
        //每个字符串都有 就每个字符串更新其最小值
        vector<int> vt(26, INT_MAX);
        for (int i = 0; i < words.size(); i++)
        {
            for (int j = 0; j < 26; j++)
            {
                int sum = count(words[i].begin(), words[i].end(), 'a'+j);
                if (sum < vt[j])
                    vt[j] = sum;
            }
        }
        vector<string> ret;
        for(int i=0;i<26;i++)
        {
            if(vt[i]!=0)
            {
                while(vt[i]--)
                {
                    ret.push_back(string(1,'a'+i));
                }
            }
        }
        return ret;
    }
};

